 
using System;
using System.Globalization;
using UnityEngine;

namespace QQSDK
{
    public class SDKFunc
    {
        public static CultureInfo culture = CultureInfo.GetCultureInfo("en-us");

        public static void Log(string log)
        {
            Debug.Log("SDK:" + log);
        }
        public static void LogError(string log)
        {
            Debug.LogError("SDK:" + log);
        }


        static public string ObjToStr(object obj)
        {
            if (obj == null)
            {
                return "";
            }
            else
            {
                return Convert.ToString(obj, culture);
            }
        }

        static public int ObjToInt32(object obj)
        {
            int iOut = 0;
            if (obj != null)
            {
                int.TryParse(obj.ToString(), out iOut);
            }
            return iOut;
        }

        static public DateTime ObjToDateTime(object obj)
        {
            if (obj != null)
            {
                DateTime tOut;
                string str = ObjToStr(obj);
                str = str.ToString(culture);
                if (DateTime.TryParse(str, culture, DateTimeStyles.None, out tOut))
                {
                    return tOut;
                }
            }
            return DateTime.MinValue;
        }
    }
}
